﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Gfw.BLL.Basic.Stock.Facilities;
using Gfw.Infrastructure.Facilities;
using Gfw.Infrastructure.User;
using Gfw.Models.Admin;

namespace Gfw.BLL.Basic.Facilities
{
    public class TransferFacilityImpl : TransferFacility
    {
        public TransferFacilityImpl(UsrUser user,UsrUser toUser,decimal count)
        :base(user,toUser,count)
        {
            
        }

        public override void Execute(Repository.UnitOfWork unitOfWork = null)
        {
            base.Execute(unitOfWork);

            //如果用户没有激活，则需要激活用户
            //激活用户，没有做强制性认证
            if (canActive)
            {
                ActiveUserFacilityImpl active = new ActiveUserFacilityImpl(_toUser.Id);
                active.Execute();

                //这里转账到了股票帐户
                AutoBuyFacility abf = new AutoBuyFacility(_toUser.Id);
                abf.Execute();
            }
        }
    }
}
